home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / JSeparator.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  2.8 KB  |  91 lines

  1. package javax.swing;
  2.  
  3. import java.awt.Component;
  4. import java.io.IOException;
  5. import java.io.ObjectOutputStream;
  6. import javax.accessibility.Accessible;
  7. import javax.accessibility.AccessibleContext;
  8. import javax.swing.plaf.SeparatorUI;
  9.  
  10. public class JSeparator extends JComponent implements SwingConstants, Accessible {
  11.    private static final String uiClassID = "SeparatorUI";
  12.    private int orientation;
  13.  
  14.    public JSeparator() {
  15.       this(0);
  16.    }
  17.  
  18.    public JSeparator(int var1) {
  19.       this.orientation = 0;
  20.       this.checkOrientation(var1);
  21.       this.orientation = var1;
  22.       this.updateUI();
  23.    }
  24.  
  25.    private void checkOrientation(int var1) {
  26.       switch (var1) {
  27.          case 0:
  28.          case 1:
  29.             return;
  30.          default:
  31.             throw new IllegalArgumentException("orientation must be one of: VERTICAL, HORIZONTAL");
  32.       }
  33.    }
  34.  
  35.    public AccessibleContext getAccessibleContext() {
  36.       if (super.accessibleContext == null) {
  37.          super.accessibleContext = new AccessibleJSeparator(this);
  38.       }
  39.  
  40.       return super.accessibleContext;
  41.    }
  42.  
  43.    public int getOrientation() {
  44.       return this.orientation;
  45.    }
  46.  
  47.    public SeparatorUI getUI() {
  48.       return (SeparatorUI)super.ui;
  49.    }
  50.  
  51.    public String getUIClassID() {
  52.       return "SeparatorUI";
  53.    }
  54.  
  55.    public boolean isFocusTraversable() {
  56.       return false;
  57.    }
  58.  
  59.    protected String paramString() {
  60.       String var1 = this.orientation == 0 ? "HORIZONTAL" : "VERTICAL";
  61.       return super.paramString() + ",orientation=" + var1;
  62.    }
  63.  
  64.    public void setOrientation(int var1) {
  65.       if (this.orientation != var1) {
  66.          int var2 = this.orientation;
  67.          this.checkOrientation(var1);
  68.          this.orientation = var1;
  69.          ((JComponent)this).firePropertyChange("orientation", var2, var1);
  70.          ((JComponent)this).revalidate();
  71.          ((Component)this).repaint();
  72.       }
  73.    }
  74.  
  75.    public void setUI(SeparatorUI var1) {
  76.       super.setUI(var1);
  77.    }
  78.  
  79.    public void updateUI() {
  80.       this.setUI((SeparatorUI)UIManager.getUI(this));
  81.    }
  82.  
  83.    private void writeObject(ObjectOutputStream var1) throws IOException {
  84.       var1.defaultWriteObject();
  85.       if (super.ui != null && this.getUIClassID().equals("SeparatorUI")) {
  86.          super.ui.installUI(this);
  87.       }
  88.  
  89.    }
  90. }
  91.